﻿<Window x:Class="Microsoft.EnhancedReminders.OutlookAddIn.AddEditNotificationRuleDialog"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ds="clr-namespace:Microsoft.EnhancedReminders.OutlookAddIn"
    xmlns:properties="clr-namespace:Microsoft.EnhancedReminders.Properties"
    xmlns:controls="clr-namespace:Microsoft.EnhancedReminders.OutlookAddIn;assembly="
    Height="500" Width="550" ResizeMode="NoResize">

    <!-- Command bindings. -->
    <Window.CommandBindings>
        <CommandBinding Command="{x:Static ds:AddEditNotificationRuleDialog.CheckBoxCommand}"
            Executed="SelectCondition" CanExecute="SelectConditionCanExecute"/>
        <CommandBinding Command="{x:Static ds:AddEditNotificationRuleDialog.BackCommand}"
            Executed="ShowConditions" CanExecute="ShowConditionsCanExecute"/>
        <CommandBinding Command="{x:Static ds:AddEditNotificationRuleDialog.NextCommand}"
            Executed="ShowActions" CanExecute="ShowActionsCanExecute"/>
        <CommandBinding Command="{x:Static ds:AddEditNotificationRuleDialog.FinishCommand}"
            Executed="Finish" CanExecute="FinishCanExecute"/>
    </Window.CommandBindings>
    
    <Window.Resources>
        <!-- Define the common style for the time/people/status panels. -->
        <Style x:Key="ConditionPanelStyle">
			<Setter Property="Grid.ColumnSpan" Value="3"/>
			<Setter Property="Grid.Column" Value="0"/>
			<Setter Property="Grid.Row" Value="4"/>
			<Setter Property="Grid.Margin" Value="30,15,30,5"/>
			<Setter Property="Grid.Visibility" Value="Hidden"/>
		</Style>

        <!-- Define the common style for the rule type selector combo box items. -->
        <Style x:Key="ComboBoxStyle">
			<Setter Property="Image.Width" Value="16"/>
			<Setter Property="Image.Height" Value="16"/>
            <Setter Property="Image.Margin" Value="2,1,2,1"/>
        </Style>

        <!-- Define the common style for the cancel/back/next/finish buttons at the bottom of the window. -->
        <Style x:Key="ButtonStyle">
            <Setter Property="Grid.Row" Value="1"/>
			<Setter Property="Grid.Margin" Value="0,8,10,8"/>
		</Style>

    </Window.Resources>

    <!-- Specify the grid which will house conditions/actions panel and the common cancel/back/next/finish buttons -->
    <Grid Name="containerGrid">
        <Grid.ColumnDefinitions >
            <ColumnDefinition />
            <ColumnDefinition />
            <ColumnDefinition />
            <ColumnDefinition />
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="40"/>
        </Grid.RowDefinitions>

        <!-- Specify the layout for specifying the rule type and conditions description. -->
        <Grid Name="conditionsGrid" Grid.Row="0" Grid.ColumnSpan="6" Grid.Column="0" Visibility="Visible">
            <Grid.ColumnDefinitions >
                <ColumnDefinition Width="125"/>
                <ColumnDefinition Width="25"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="15"/>
                <RowDefinition Height="40"/>
                <RowDefinition Height="40"/>
                <RowDefinition Height="75"/>
                <RowDefinition/>
            </Grid.RowDefinitions>

            <!-- name -->
            <Border Grid.ColumnSpan="3" Grid.Column="0" Grid.Row="1" Margin="15,3,15,3" BorderThickness="1" BorderBrush="Gray" Height="Auto" VerticalAlignment="Stretch" />
            <Label Margin="30,0,0,0" Grid.Row="1" Grid.Column="0" Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Center" Width="Auto" Content="{x:Static properties:Resources.RulesDialogName}"/>
            <TextBox Margin="0,0,50,0" Name="nameTextBox" Grid.Row="1" Grid.ColumnSpan="2" Grid.Column="1" Height="Auto" VerticalAlignment="Center" HorizontalAlignment="Stretch" Width="Auto" TextChanged="NameTextBox_TextChanged"/>

            <!-- target type selection -->
            <Border Grid.ColumnSpan="3" Grid.Column="0" Grid.RowSpan="2" Grid.Row="3" Margin="15,3,15,3" BorderThickness="1" BorderBrush="Gray" Height="Auto" VerticalAlignment="Stretch" />
            <Label Margin="30,0,0,0" Grid.Row="2" Grid.Column="0"  Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Center" Width="Auto" Content="{x:Static properties:Resources.RulesDialogTarget}"/>
            <ComboBox Name="ruleTypeComboBox" Grid.Row="2" Grid.ColumnSpan="2" Grid.Column="1" VerticalAlignment="Center" Margin="0,0,250,0"
                  SelectedIndex="{Binding Path=RuleTypeSelectedIndex, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ds:AddEditNotificationRuleDialog}}, Mode=TwoWay}">
                <ComboBoxItem>
                    <StackPanel Orientation="Horizontal">
                        <Image Source="..\Images\Voicemail.png" Style="{StaticResource ComboBoxStyle}"/>
                        <TextBlock VerticalAlignment="Center" Text="{x:Static properties:Resources.RulesDialogNewVoiceMails}"/>
                </StackPanel>
                </ComboBoxItem>
                <ComboBoxItem>
                    <StackPanel Orientation="Horizontal">
                        <Image Source="..\Images\Calendar.png" Style="{StaticResource ComboBoxStyle}"/>
                        <TextBlock VerticalAlignment="Center"  Text="{x:Static properties:Resources.RulesDialogCalendarItems}"/>
                </StackPanel>
                </ComboBoxItem>
                <ComboBoxItem IsEnabled="False">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="..\Images\Email.png" Style="{StaticResource ComboBoxStyle}"/>
                        <TextBlock VerticalAlignment="Center" Text="{x:Static properties:Resources.RulesDialogNewEMails}"/>
                </StackPanel>
                </ComboBoxItem>
                <ComboBoxItem IsEnabled="False">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="..\Images\Tasks.png" Style="{StaticResource ComboBoxStyle}"/>
                        <TextBlock VerticalAlignment="Center" Text="{x:Static properties:Resources.RulesDialogTasks}"/>
                </StackPanel>
                </ComboBoxItem>
            </ComboBox>

            <!-- conditions for time, people and status -->
            <Border Grid.ColumnSpan="3" Grid.Column="0" Grid.Row="2" Margin="15,3,15,3" BorderThickness="1" BorderBrush="Gray" Height="Auto" VerticalAlignment="Stretch" />
            <Label Margin="30,5,0,0" Grid.Row="3" Grid.Column="0"  HorizontalAlignment="Left" VerticalAlignment="Top" Width="Auto" Content="{x:Static properties:Resources.RulesDialogConditions}"/>
			<CheckBox Margin="0,12,0,0" Name="timeCheckBox" Grid.Row="3" Grid.Column="1" Height="Auto" HorizontalAlignment="Center"  VerticalAlignment="Top" Command="{x:Static ds:AddEditNotificationRuleDialog.CheckBoxCommand}"/>
			<TextBlock Margin="0,12,40,0" Name="timeTextBlock" Grid.Row="3" Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Top" MouseLeftButtonDown="ShowCondition" Text="{x:Static properties:Resources.RulesDialogDefaultTimeDescription}"/>

            <CheckBox Name="peopleCheckBox" Grid.Row="3" Grid.Column="1"  Height="Auto" HorizontalAlignment="Center"  VerticalAlignment="Center" Command="{x:Static ds:AddEditNotificationRuleDialog.CheckBoxCommand}"/>
            <TextBlock Margin="0,0,40,0"  Name="peopleTextBlock" Grid.Row="3" Grid.Column="2"  HorizontalAlignment="Stretch" VerticalAlignment="Center" MouseLeftButtonDown="ShowCondition" Text="{x:Static properties:Resources.RulesDialogDefaultPeopleDescription}"/>

            <CheckBox Margin="0,0,0,12" Name="statusCheckBox" Grid.Row="3" Grid.Column="1" Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Bottom" Command="{x:Static ds:AddEditNotificationRuleDialog.CheckBoxCommand}"/>
            <TextBlock Margin="0,0,40,12" Name="statusTextBlock" Grid.Row="3" Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" MouseLeftButtonDown="ShowCondition" Text="{x:Static properties:Resources.RulesDialogDefaultStatusDescription}"/>

            <Separator Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="3" Height="3" Margin="50,0,50,0" VerticalAlignment="Bottom" />

            <!-- time control -->
            <ScrollViewer Name="timePanel" Style="{StaticResource ConditionPanelStyle}">
                <controls:TimeControl x:Name="timeControl"/>
            </ScrollViewer>

            <!-- people control -->
            <DockPanel Name="peoplePanel"  Style="{StaticResource ConditionPanelStyle}">
                <controls:PeopleControl x:Name="peopleControl" VerticalAlignment="Center"/>
            </DockPanel>

            <!-- status control -->
            <DockPanel Name="statusPanel" Style="{StaticResource ConditionPanelStyle}">
                <controls:StatusControl x:Name="statusControl" Margin="75,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
            </DockPanel>

        </Grid>
        
        <!-- Actions control for voicemail rules (initially hidden) -->
        <Grid Name="voicemailActionsGrid" Grid.ColumnSpan="6" Visibility="Hidden">
            <Border Margin="15,18,15,3" BorderThickness="1" BorderBrush="Gray" />
            <StackPanel>
                <TextBlock TextWrapping="Wrap" Margin="35,60,40,30" VerticalAlignment="Top" HorizontalAlignment="Center" Text="{x:Static properties:Resources.ActionDialogChannelsLabel1}"/>
                <controls:ReadOnlyChannelControl x:Name="voicemailChannelsControl" HorizontalAlignment="Center" VerticalAlignment="Center" />
            </StackPanel>
        </Grid>
        
        <!-- Actions control for calendar rules (initially hidden) -->
        <Grid Name="calendarActionsGrid" Grid.ColumnSpan="6" Visibility="Hidden">
            <controls:CalendarActionsControl Margin="15,15,15,3" x:Name="calendarActionsControl"/>
        </Grid>

        <!-- Cancel button -->
        <Button Name="cancelButton" IsCancel="True" Grid.Column="2" Style="{StaticResource ButtonStyle}" Content="{x:Static properties:Resources.CancelButton2}"/>
        
        <!-- Back button -->
        <Button Grid.Column="3" Style="{StaticResource ButtonStyle}" Command="{x:Static ds:AddEditNotificationRuleDialog.BackCommand}" Content="{x:Static properties:Resources.RulesDialogBackButton}"/>

        <!-- Next button -->
        <Button Name="nextButton" Grid.Column="4" Style="{StaticResource ButtonStyle}" Command="{x:Static ds:AddEditNotificationRuleDialog.NextCommand}" Content="{x:Static properties:Resources.RulesDialogNextButton}"/>
    
        <!-- Finish button -->
        <Button Name="finishButton" IsDefault="True" Grid.Column="5" Grid.Row="1" Margin="0,8,15,8" Command="{x:Static ds:AddEditNotificationRuleDialog.FinishCommand}" Content="{x:Static properties:Resources.RulesDialogFinishButton}"/>
    </Grid>

</Window>
